package cj.web.portal.dao;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;

/**
 * 订报业务
 * @author Administrator
 *
 */
@DAO
public interface KDBookingDAO {

	@SQL("INSERT INTO KDBookingPaper (type,beginAt,subPeriod,subNum,link,phone,tel,descs,invoiceTitle,city,area,street,address,prize,status,deleteFlag,createUser,createAT,updateUser,updateAT) VALUES (:t.type,:t.beginAt,:t.subPeriod,:t.subNum,:t.link,:t.phone,:t.tel,:t.descs,:t.invoiceTitle,:t.city,:t.area,:t.street,:t.address,:t.prize,:t.status,:t.deleteFlag,:t.createUser,now(),:t.updateUser,now())")
	void createKDBookingPaper(@SQLParam("t") Map rep);
	
	@SQL("INSERT INTO KDRecovePaper (inType,link,phone,city,area,street,address,status,deleteFlag,createUser,createAT,updateUser,updateAT,weight,descs,type,category) VALUES (:t.inType,:t.link,:t.phone,:t.city,:t.area,:t.street,:t.address,:t.status,:t.deleteFlag,:t.createUser,now(),:t.updateUser,now(),:t.weight,:t.descs,:t.type,:t.category)")
	void createKDOldBooking(@SQLParam("t") Map rep);
	
	@SQL("INSERT INTO KDChangeAddress (type,link,phone,tel,invoiceNo,oldCity,oldArea,oldStreet,oldAddress,newCity,newArea,newStreet,newAddress,status,deleteFlag,createUser,createAT,updateUser,updateAT) VALUES (:t.type,:t.link,:t.phone,:t.tel,:t.invoiceNo,:t.oldCity,:t.oldArea,:t.oldStreet,:t.oldAddress,:t.newCity,:t.newArea,:t.newStreet,:t.newAddress,:t.status,:t.deleteFlag,:t.createUser,now(),:t.updateUser,now())")
	void createKDChangeBooking(@SQLParam("t") Map rep);
	
	@SQL("INSERT INTO KDAdvise (inType,link,phone,msg,status,deleteFlag,createUser,createAT,updateUser,updateAT) VALUES (:t.inType,:t.link,:t.phone,:t.msg,:t.status,:t.deleteFlag,:t.createUser,now(),:t.updateUser,now())")
	void createKDAdvise(@SQLParam("t") Map rep);
	
	//判断订报卡是否有效
	@SQL("SELECT cardPwd,paperName,paperCardName,months FROM KDCard WHERE cardNum=:1 AND deleteFlag=1 AND status=0")
	List<Map> validateCard(String cardNum);
	
	//判断订报卡是否有效_无状态判断
	@SQL("SELECT cardPwd,paperName,paperCardName,months,status FROM KDCard WHERE cardNum=:1 AND deleteFlag=1 ")
	List<Map> validateCardNoStatus(String cardNum);

	@SQL("INSERT INTO KDBookingCard(inType,account,pwd,link,phone,city,area,street,address,status,deleteFlag,createUser,createAT,updateUser,updateAT,beginAt) VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,0,1,'portal',now(),'portal',now(),:10)")
	void saveBookingCard(int inType,String cardNum, String cardPwd, String link,
			String phone, int wuhancity, int areaVal, int streetVal,
			String address,String beginAt);

	@SQL("UPDATE KDCard SET status=1,updateAt=now() WHERE cardNum=:1")
	void updateStatus(String cardNum);
	
	
}
